package com.nuoniu.sibanyun.controller.expenses;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.expenses.dto.ExpensesBalanceChangeRecordSearchDto;
import com.nuoniu.sibanyun.entity.expenses.dto.ExpensesBusinessOrderSearchDto;
import com.nuoniu.sibanyun.service.expenses.IExpensesBusinessOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 费用中心-业务订单 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2022-05-06
 */
@RestController
@RequestMapping("/expenses/businessOrder")
@Api(value="费用中心-业务订单 ",tags={"费用中心-业务订单"})
public class ExpensesBusinessOrderController extends BaseController {

    @Autowired
    private IExpensesBusinessOrderService businessOrderService;

    @PostMapping("pageList")
    @ApiOperation(value = "分页查询 业务订单")
    public HttpResult pageList(@RequestBody ExpensesBusinessOrderSearchDto businessOrderSearchDto) {
        return HttpResult.ok(businessOrderService.pageList(businessOrderSearchDto));
    }

    @PostMapping("sysPageList")
    @ApiOperation(value = "分页查询 业务订单")
    @PreAuthorize("'system' == authentication.principal ")
    public HttpResult sysPageList(@RequestBody ExpensesBusinessOrderSearchDto businessOrderSearchDto) {
        return HttpResult.ok(businessOrderService.sysPageList(businessOrderSearchDto));
    }

    @GetMapping("getByCrmGoodsOrderId")
    @ApiOperation(value = "业务订单详情")
    public HttpResult getByCrmGoodsOrderId(Long orderId) {
        return HttpResult.ok(businessOrderService.getByCrmGoodsOrderId(orderId));
    }


}
